'use strict'

const crypto = require('crypto');

module.exports = function (backClient) {
    var skininterface = {
        'test': function (mixnick, dataURL) {
            console.log({
                'image': dataURL,
                'mixnick': mixnick,
                'source': 'morefun'
            });
            return new Promise(function (resolve) {
                backClient.execute('tmall.marketing.face.skindetect', {
                    'image': dataURL,
                    'mixnick': mixnick,
                    'source': 'morefun'
                }, function (error, response) {
                    console.log(error, response);
                    if (!error) resolve(response);
                    else resolve(error);
                });
            });
        }
    }
    return {
        skininterface: skininterface
    }
}